package com.itheima2;

import java.util.ArrayList;
import java.util.Scanner;

public class Work {
    public static void main(String[] args) {
        ArrayList<Integer> ger = new ArrayList<>();
        Scanner sc =new Scanner(System.in);
        scanner(ger, sc);
        double max= ger.get(0);
        double min= ger.get(0);
        double sum = 0 ;

        maxAndMin(ger, max, min,sum);





    }

    private static void maxAndMin(ArrayList<Integer> ger, double max, double min,double sum) {
            int num=0;
        for (int i = 0; i < ger.size(); i++) {
            if(ger.get(i)>max){
                max=ger.get(i);
            }else if(ger.get(i)<min){
                min=ger.get(i);
            }
            num+=ger.get(i);

        } System.out.println(num+" "+max+" "+min);
        sum = (num - max - min) / (ger.size()-2);
        System.out.println("选手最终得分为："+sum);

    }

    private static void scanner(ArrayList<Integer> ger, Scanner sc) {
        for (int i = 1; i <9 ; i++) {
            System.out.println("请录入第"+i+"个评委成绩：");
            int fen = sc.nextInt();

            ger.add(fen);

        }
    }
}
